﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Free.Master" Inherits="System.Web.Mvc.ViewPage<Pp.Dto.UserEditDto>" %>

<%@ Import Namespace="Pp.Dto" %>
<%@ Import Namespace="Pp.UI.Models" %>
<%@ Import Namespace="Pp.Globalization" %>
<%@ Import Namespace="Ilgera.TMS.UI.Web.Helpers" %>
<%@ Import Namespace="Pp.Core.Extentions" %>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h2>
        <%=Res.Label_ProfileEdit %></h2>
    <%=Html.ValidationSummary() %>
    <% using (Html.BeginForm())
       { %>
    <%: Html.ValidationSummary(true) %>
    <div class="updatePanel">
        <ul>
            <li><a href="#accountInfo"><%=Res.Title_AccountInfo %></a></li>
            <li><a href="#personelInfo"><%=Res.Title_PersonelInfo%></a></li>
            <li><a href="#pictureInfo"><%=Res.Title_Picture %></a></li>
            <li><a href="#cvInfoCnt"><%=Res.Title_Cv%></a></li>
        </ul>
        <div id="accountInfo">
            <%=Html.TextBox<UserEditDto>(d => d.Username, Res.Label_Username, Model.Username)%>
            <%=Html.TextBox<UserEditDto>(d => d.MailAdress, Res.Label_MailAdress, Model.MailAdress)%>
            <%=Html.CheckBox<UserEditDto>(d => d.MailAdressVisible, Res.Label_MailAdressVisible, Model.MailAdressVisible, Res.Label_Yes, Res.Label_No)%>
        </div>
        <div id="personelInfo">
            <%=Html.TextBox<UserEditDto>(d => d.FirstName, Res.Label_FirstName, Model.FirstName)%>
            <%=Html.TextBox<UserEditDto>(d => d.LastName, Res.Label_LastName, Model.LastName)%>
            <%=Html.CheckBox<UserEditDto>(d => d.IsMan, Res.Label_Sex, Model.IsMan, Res.Label_Man, Res.Label_Women)%>
            <%=Html.TextBox<UserEditDto>(Res.Label_BirthDate, d => d.BirthDay)%>
            <%=Html.DropDownList<UserEditDto>(d => d.City, Res.Label_City, new SelectList(SiteConstants.Cities))%>
            <%=Html.DropDownList<UserEditDto>(d => d.WorkInfo, Res.Label_Sector, new SelectList(SiteConstants.WorkInfos))%>
            <%=Html.DropDownList<UserEditDto>(d => d.EducationalInfo, Res.Label_Educational, new SelectList(SiteConstants.EducationInfos))%>
        </div>
        <div id="pictureInfo">
            <%=Html.FileUploader<UserEditDto>(d => d.PictureFile, Res.Label_UploadPicture,UploadType.Image)%>
            <img src="<%=Model.Id.ToLargeImageString(ImageType.Profile) %>" />
        </div>
        <div id="cvInfoCnt">
            <%=Html.TextArea<UserEditDto>(d => d.CvInfo, Res.Label_CvInfo, Server.HtmlDecode(Model.CvInfo))%></div>
    </div>
    <%=Html.Submit(Res.Label_Save,false) %>
    <% } %>
    <script>
        bkLib.onDomLoaded(function () {
            var a = new nicEditor().panelInstance('CvInfo');
            if (navigator.appName == "Netscape") {
                $(".nicEdit-main").parent().css("margin-left", "150px");
            }
        });
        $(document).ready(function () {
            $("input[name='Username']").change(function () {
                ControlUserName($(this));
            });
            $("form input[type='submit']").click(function () {
                $(this).parent().submit();
                $(this).parent().submit();
            });
            $("#BirthDay").datepicker();
            $("#BirthDay").datepicker("option", "changeYear", true);
            $("#BirthDay").datepicker("option", "changeMonth", true);
            $(".updatePanel").tabs();
        });        
    </script>
</asp:Content>
